import QtQuick 2.4
import Qt.labs.controls 1.0
import QtQuick.Layouts 1.1
import "../template" as Template
import Qt.labs.settings 1.0
Template.PopupFrame {
    id: pop
    title: "填写测试结果"
    contentHeight: 270
    property int  index: 0
    property string tid: ""
    signal callback(int times, bool pass, string description)

    function load(pass, description) {
    if (pass)
        checkBtn.checked = true

    textField.text = description
    }

    Pane {
        Settings {
            category: "times"
            property alias times: spBox.value
        }
        ColumnLayout {
            id: col
            anchors.fill: parent
            anchors.margins: 9
            spacing: 12

            RowLayout {
                Layout.alignment: Qt.AlignHCenter
                Label {
                    text: "第"
                }
                SpinBox {
                    id: spBox
                    from: 1
                    to: 10
                    value: 1
                }
                Label {
                    text: "测试"
                }
            }

            RowLayout {
                Layout.alignment: Qt.AlignHCenter
                RadioButton{
                    text: "通过"
                     id: checkBtn
                }
                RadioButton{
                    text: "未通过"
                    checked: true
                }
            }

            RowLayout {
                Layout.fillWidth: true
                Label {
                    text: "描述"
                }
                TextField {
                    id: textField
                    Layout.fillWidth: true
                }
            }
        }
    }

    onClicked: {
        callback(spBox.value, checkBtn.checked, textField.text)
        pop.close()
    }
}
